#ifndef MCP2515_h
#define MCP2515_h
#define byte unsigned char

/*
	SPIBUS clock 8
	SPIBUS out	10
	SPIBUS in	12
	CHIP_SELECT	4
*/

typedef struct CanPacket
{
	unsigned int standarID;
	unsigned int extendedID;
	unsigned char numData;
	unsigned char data[8];
	
}CanPacket;

void MCPSendPacket(CanPacket packet);
int MCPReceivePacket(CanPacket *packet);

void SPIInit();
void MCPInit();
unsigned char MCPReadRegister(unsigned char adress);
BOOL Can_init(int CAN_Bus_Speed, byte Freq, byte SJW, BOOL autoBaud);
int AutoBaud(int CAN_Bus_Speed, byte Freq, byte SJW);
#endif
